package com.ruike.service.impl;

import com.github.pagehelper.PageHelper;
import com.ruike.mapper.ClassroomMapper;
import com.ruike.pojo.AcademicBuilding;
import com.ruike.pojo.Classroom;
import com.ruike.service.ClassroomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 吴泽胜
 * @FileName ClassroomServiceImpl
 * @date 2021-01-25 11:49 下午
 * @Software: IntelliJ IDEA
 */
@Service
public class ClassroomServiceImpl implements ClassroomService {

    @Autowired
    private ClassroomMapper classroomMapper;

    @Override
    public List<Classroom> getClassroomList() throws Exception {
        return classroomMapper.getClassroomList();
    }

    @Override
    public void updataStateById(Classroom classroom) throws Exception {
        classroomMapper.updataStateById(classroom);
    }

    @Override
    public Classroom findClassroomById(Integer id) throws Exception {
        return classroomMapper.findClassroomById(id);
    }

    @Override
    public void deleteClassroomById(Integer id) throws Exception {
        classroomMapper.deleteClassroomById(id);
    }

    @Override
    public void updateClassroomById(Classroom classroom) throws Exception {
        classroomMapper.updateClassroomById(classroom);
    }

    @Override
    public void addClassroom(Classroom classroom) throws Exception {
        classroomMapper.addClassroom(classroom);
    }

    @Override
    public List<Classroom> getAcademicBuildingListByPageHelper(Integer pageNum, Integer pageSize) throws Exception {
        // 开始分页
        PageHelper.startPage(pageNum,pageSize);
        return classroomMapper.getClassroomList();
    }

    @Override
    public List<Classroom> fuzzyClassroomList(String searchParam) throws Exception {
        return classroomMapper.fuzzyClassroomList(searchParam);
    }

    @Override
    public List<Classroom> fuzzyAndAB_IDClassroomList(String searchParam, String academic_building_ID, Integer pageNum, Integer pageSize) throws Exception {
        // 开始分页
        PageHelper.startPage(pageNum,pageSize);
        return classroomMapper.fuzzyAndAB_IDClassroomList(searchParam, academic_building_ID);
    }
}
